<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Applicant</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link rel="stylesheet" href="css/bootstrap.min.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link rel="stylesheet" href="css/simple-line-icons.css">
<link rel="stylesheet" href="css/animate.css">
<link href="templatemo_style.css" rel="stylesheet" type="text/css" /> 
<link href="css/matches.css" rel="stylesheet" type="text/css" /> 
<link href="css/search.css" rel="stylesheet" type="text/css" /> 
<link href="fullsize/fullsize.css" media="screen" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="fullsize/jquery.js"></script>
<script type="text/javascript" src="fullsize/jquery.fullsize.minified.js"></script>       
<script src="../vendor/Mustache/mustache.js-master/mustache.js"></script>    <!-- global -->
<script src="../jQueryAssets/jquery-1.8.3.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">

function clearText(field)
{
	if (field.defaultValue == field.value) field.value = '';
	else if (field.value == '') field.value = field.defaultValue;
}
//$(function(){
//				$("div.templatemo_gallery img").fullsize();
//			});
</script>
<?php

include __DIR__ ."../../PHP/db.php";

if ($_SESSION['login'] == NULL)
{
 header("Location: ../index.php");	
}
else
{
$login = $_SESSION['login'];

$userid = mysql_query("SELECT * FROM `flss`.`accounts` WHERE `user` = '$login'");
while($rowshow = mysql_fetch_array($userid))
{
	$getid = $rowshow['account_id'];
}

$getresume = mysql_query("SELECT * FROM `flss`.`applicant` WHERE `applicant_id` = '$getid'");
while($rowdate = mysql_fetch_array($getresume))
{
	$getdateofupdate = $rowdate['Resume_Updated'];
}

if(!$getdateofupdate)
	{
	   header("Location:start.php");
	}

		
//get employers job and details
$getaname = mysql_query("SELECT * FROM `flss`.`applicant` WHERE `applicant_id` = '$getid'") or die(mysql_error());
$getaaddress = mysql_query("SELECT * FROM `flss`.`a_address` WHERE `applicant_id` = '$getid'") or die(mysql_error());
$getaheight = mysql_query("SELECT * FROM `flss`.`applicant` WHERE `applicant_id` = '$getid'") or die(mysql_error());
$getaweight = mysql_query("SELECT * FROM `flss`.`applicant` WHERE `applicant_id` = '$getid'") or die(mysql_error());
$getnationality = mysql_query("SELECT * FROM `flss`.`applicant` WHERE `applicant_id` = '$getid'") or die(mysql_error());
$getaname2 = mysql_query("SELECT * FROM `flss`.`applicant` WHERE `applicant_id` = '$getid'") or die(mysql_error());

}
$applicant_id = $getid;



while($row = mysql_fetch_array($getaname))
{
  $cphoto = $row['photo'];
}

$photo = empty($cphoto) ? DEFAULT_COVER : IMAGE_URL_SMALL.$cphoto;

?>
				<style>
                .circle {
                  display: block;
                  width: 100px;
                  height: 100px;
                  margin: 1em auto;
                  margin-right: 20px;
                  background-size: cover;
                  background-repeat: no-repeat;
                  float: left;
                  border: 2px solid #eee;
                  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);  
                }
                </style>

</head>
<body>
<?php
 include __DIR__ . "/../php/headerapp.php";

?>
    <div id="templatemo_container"> 
		<div class="home-projects">
        <div class="row">
          <div class="col-md-6 col-sm-12">
            <div class="project-title animated fadeInUp" style="width:960px; margin-left:-20px">
              <div style="height:220px; display:block; margin-top:10px; ">
              	<div class="circle">
                <img id="myPic" src="<?=$photo?>" height="100" width="100"/>
                 <label >
                  <div style="margin-top:-100px;">
                	<img  id="UploadPhoto" src="images/camerapic.png" style="height:18px; cursor:pointer;">
                  </div>
             	 </label>
              	<input id="logoFile" type="file" style="display: none">
             	</div>
                
              <label style="margin-top:4px;"><h2><?php while($rowaname = mysql_fetch_array($getaname2))
										{ echo $rowaname['fname'].' '.$rowaname['lname']; } ?></h2></label>
              <div id="main-content">
              <table width="200">
              <tr>
              <td>
              Address:
              </td>
              <td>
              <label><?php while($rowaaddress = mysql_fetch_array($getaaddress))
					{ echo $rowaaddress['a_adress'].' '.$rowaaddress['city'].' '.$rowaaddress['country']; } ?></label><br>
              </td>
              </tr>
              <tr>
              <td>
              Height:
              </td>
              <td>
              <label><?php while($rowaheight = mysql_fetch_array($getaheight))
					{ echo $rowaheight['height']; } ?></label><br>
              </td>
              </tr>
              <tr>
              <td>
              Weight:
              </td>
              <td>
              <label><?php while($rowaweight = mysql_fetch_array($getaweight))
					{ echo $rowaweight['weight']; } ?></label><br>
              </td>
              </tr>
              <tr>
              <td>
              Nationality:
              </td>
              <td>
              <label><?php while($rowanationality = mysql_fetch_array($getnationality))
					{ echo $rowanationality['nationality']; } ?></label>
               </td>
               </tr>
               </table>
                   </div>
               </div>
                
              <a href="resume.php" style="text-decoration:none" class="pink-button">Edit Information</a>
            </div>
          </div>
        </div>
      </div>
      <div class="templaemo_h_line"></div>
      <div class="templatemo_section_7">
        <h1>Calendar</h1>

        <script language="javascript" type="text/javascript">
        var day_of_week = new Array('Sun','Mon','Tue','Wed','Thu','Fri','Sat');
        var month_of_year = new Array('January','February','March','April','May','June','July','August','September','October','November','December');

        //  DECLARE AND INITIALIZE VARIABLES
        var Calendar = new Date();

        var year = Calendar.getFullYear();     // Returns year
        var month = Calendar.getMonth();    // Returns month (0-11)
        var today = Calendar.getDate();    // Returns day (1-31)
        var weekday = Calendar.getDay();    // Returns day (1-31)

        var DAYS_OF_WEEK = 7;    // "constant" for number of days in a week
        var DAYS_OF_MONTH = 31;    // "constant" for number of days in a month
        var cal;    // Used for printing

        Calendar.setDate(1);    // Start the calendar day at '1'
        Calendar.setMonth(month);    // Start the calendar month at now


        /* VARIABLES FOR FORMATTING
        NOTE: You can format the 'BORDER', 'BGCOLOR', 'CELLPADDING', 'BORDERCOLOR'
              tags to customize your caledanr's look. */

        var TR_start = '<TR>';
        var TR_end = '</TR>';
        var highlight_start = '<TD WIDTH="30"><TABLE CELLSPACING=10 BORDER=1 BGCOLOR=DEDEFF BORDERCOLOR=CCCCCC><TR><TD WIDTH="20"><B><CENTER>';
        var highlight_end   = '</CENTER></TD></TR></TABLE></B>';
        var TD_start = '<TD WIDTH="60"  HEIGHT="10"><CENTER>';
        var TD_end = '</CENTER></TD>';

        /* BEGIN CODE FOR CALENDAR
        NOTE: You can format the 'BORDER', 'BGCOLOR', 'CELLPADDING', 'BORDERCOLOR'
        tags to customize your calendar's look.*/

        cal =  '<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=0 BORDERCOLOR=BBBBBB><TR><TD>';
        cal += '<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0' + TR_start;
        cal += '<TD COLSPAN="' + DAYS_OF_WEEK + '" BGCOLOR="#EFEFEF"><CENTER><B>';
        cal += month_of_year[month]  + '   ' + year + '</B>' + TD_end + TR_end;
        cal += TR_start;

        //   Loops   //

        // LOOPS FOR EACH DAY OF WEEK
        for(index=0; index < DAYS_OF_WEEK; index++)
        {

        // BOLD TODAY'S DAY OF WEEK
        if(weekday == index)
        cal += TD_start + '<B>' + day_of_week[index] + '</B>' + TD_end;

        // PRINTS DAY
        else
        cal += TD_start + day_of_week[index] + TD_end;
        }

        cal += TD_end + TR_end;
        cal += TR_start;

        // FILL IN BLANK GAPS UNTIL TODAY'S DAY
        for(index=0; index < Calendar.getDay(); index++)
        cal += TD_start + '  ' + TD_end;

        // LOOPS FOR EACH DAY IN CALENDAR
        for(index=0; index < DAYS_OF_MONTH; index++)
        {
        if( Calendar.getDate() > index )
        {
          // RETURNS THE NEXT DAY TO PRINT
          week_day =Calendar.getDay();

          // START NEW ROW FOR FIRST DAY OF WEEK
          if(week_day == 0)
          cal += TR_start;

          if(week_day != DAYS_OF_WEEK)
          {

          // SET VARIABLE INSIDE LOOP FOR INCREMENTING PURPOSES
          var day  = Calendar.getDate();

          // HIGHLIGHT TODAY'S DATE
          if( today==Calendar.getDate() )
          cal += highlight_start + day + highlight_end + TD_end;

          // PRINTS DAY
          else
          cal += TD_start + day + TD_end;
          }

          // END ROW FOR LAST DAY OF WEEK
          if(week_day == DAYS_OF_WEEK)
          cal += TR_end;
          }

          // INCREMENTS UNTIL END OF THE MONTH
          Calendar.setDate(Calendar.getDate()+1);

        }// end for loop

        cal += '</TD></TR></TABLE></TABLE>';

        //  PRINT CALENDAR
        document.write(cal);

        //  End -->
</script>

                 <?php include 'notif/notif.php'; ?>  
              
                 <div class="templatemo_section_11">
                  <h1>Categories</h1>
                    <ul>
                      <li><a href="profile.php">Job Registrations</a></li>
                      <li><a href="interviewsched.php">Interview Schedule</a></li>
                    </ul>
                </div>
</div>            <!-- End of left -->
   <div id="templatemo_right">
   		<div class="jmatches">
		<div class="jmatchesheader">
		  	<p><center>Jobs Suggestions</center></p>
  		</div>
        <div class="jmatchescontainer">
        <?php
		 $getall = mysql_query("SELECT  jo.* 
						FROM job_order jo
						WHERE jo.status =  '1'");

		 while($rows = mysql_fetch_array($getall))
				{
					$gettitle = $rows['Title'];
					$getemployerid = $rows['employer_id'];
					$getemp = mysql_query("SELECT * FROM `flss`.`employer` WHERE `employer_id` = '$getemployerid' ") or die(mysql_error());
					while($rows1 = mysql_fetch_array($getemp))
					{
						$getemployername = $rows1['ename'];
						}
					$refid = $rows['refid'];
					$getyoe = $rows['Job_yoe'];
					$getmined = $rows['Job_mined'];
					$getdayposted = $rows['date_posted'];
					$getrequirements = $rows['Job_requirements'];
		?>
  		<a href="../Employer/Job/joborder.php?refid=<?php echo $refid ?>" onClick="window.open(this.href,'popupwindow','left=200,top=50,width=1000,height=600,scrollbars=yes,menu=0,status=0'); return false;" style=" text-decoration:none;">
          <div class="job-row" style="display: block;">
            <div class="job-block -left">
                <div class="block-header">
                    <p class="title"><?php echo $gettitle ?></p>
                    <p class="company"><?php echo $getemployername ?></p>
                        <div class="job-logo">
                            <div class="job-logo-wrapper" style="background: url('') 100% 0% no-repeat;">
                            </div>
                        </div>
                </div>
                <div class="info-white" style="padding-right: 160px;">
                    <div class="workloc"> </div>
                </div>
                <span class="job-desc" style="padding-right: 160px;">
                    <ul>
                    <li><?php echo $getyoe ?></li>
                    <li><?php echo $getmined ?></li>
                    </ul>
                </span>
                <span class="posted-time"> <?php 
				$dtime = new DateTime($getdayposted);
							print $dtime->format("F d, Y");	 
				 
				 ?></span>
            </div>
                <div class="clear"></div>
           </div>
           </a>
          <?php } ?> 
         
           
        </div>   
                    
    </div>
</div>
 <script type="text/javascript">// <![CDATA[
				$(function(){
          $('#UploadPhoto').click(function(){
              $('#logoFile').click();
            
              return false;
          });


        function uploadPhoto(applicant_id,from)
        { 
           var params = {};
           params.applicant_id = applicant_id;
           params.from = from;
           return $.ajax({
              url: '../api/upload2.php',
              data: params,
              type: 'post',
              dataType : 'json'
           });

        }

          function readURL(input)
          {
              if (input.files && input.files[0]) {
                  var reader = new FileReader();
                  reader.onload = function (e) {
                      path = e.target.result;
                      
                      uploadPhoto("<?=$applicant_id?>",path).done(function(result){
                      if(result.status == "true")
                      {
                         $('#myPic').attr('src',path);
                      }
                      else
                      {
                         alert('There is a problem uploading your photo please try again later');
                      }
                    });
                  }
                  reader.readAsDataURL(input.files[0]);
              }
          }
          $('#logoFile').change(function(){
            readURL(this);
          });
          $(document).ready(function(){
            
              var pusher = new Pusher("<?=PUSHER_APP_KEY?>");
              var channel = pusher.subscribe('my-channel');
              
              channel.bind('job-posted', function(data) {

                
                  var job_order_id = data.job_order_id;
                    
            var params = {};
            params.job_order_id = job_order_id;
               
                  $.ajax({
                      url: '../api/get_job_info.php',
                      type: 'post',
                      data: params,
                      dataType: 'json',
                      success: function(msg){
                         var template = $('#sampleTpl').html();
                         var html = Mustache.to_html(template,msg.data[0]);
                         $('.jmatchescontainer').prepend(html);  
                      }
                      
                  });
              

              });

          });

				  $(".your-div").each(function(i){
					len=$(this).text().length;
					if(len>40)
					{
					  $(this).text($(this).text().substr(0,40)+'...');
					}
				  });
				});
			// ]]></script>
     <!-- End Of Container -->
</div>

<script type="text/javascript">



</script>
<script src="//js.pusher.com/2.2/pusher.min.js"></script> <!-- global -->
<script type="text/template" id="sampleTpl">
  <a href="../Employer/Job/joborder.php?refid={{refid}}" onClick="window.open(this.href,'popupwindow','left=200,top=50,width=1000,height=600,scrollbars=yes,menu=0,status=0'); return false;" style=" text-decoration:none;">
          <div class="job-row" style="display: block;">
            <div class="job-block -left">
                <div class="block-header">
                    <p class="title">{{Title}}</p>
                    <p class="company">{{ename}}</p>
                        <div class="job-logo">
                            <div class="job-logo-wrapper" style="background: url('') 100% 0% no-repeat;">
                            </div>
                        </div>
                </div>
                <div class="info-white" style="padding-right: 160px;">
                    <div class="workloc"> </div>
                </div>
                <span class="job-desc" style="padding-right: 160px;">
                    <ul>
                    <li>{{{Job_yoe}}}</li>
                    <li>{{{Job_mined}}}</li>
                    <li><div class="your-div">{{{Job_requirements}}}</div> </li>
                    </ul>
                </span>
                <span class="posted-time">{{date_posted}}</span>
            </div>
                <div class="clear"></div>
           </div>
     </a>

</script>

<?php
 include __DIR__ . "/../php/footer.php";

?>




</body>
</html>